/*     */ package com.feeyin.radar.sys.controller;
/*     */ 
/*     */ import com.feeyin.radar.commons.StringUtils;
/*     */ import com.feeyin.radar.sys.model.Country;
/*     */ import com.feeyin.radar.sys.model.RecordRange;
/*     */ import com.feeyin.radar.sys.service.DataDictionaryService;
/*     */ import com.feeyin.radar.sys.service.RecordRangeService;
/*     */ import java.util.HashMap;
/*     */ import java.util.Map;
/*     */ import javax.servlet.http.HttpServletRequest;
/*     */ import javax.servlet.http.HttpServletResponse;
/*     */ import org.springframework.web.servlet.ModelAndView;
/*     */ import org.springframework.web.servlet.mvc.multiaction.MultiActionController;
/*     */ import org.springframework.web.servlet.view.RedirectView;
/*     */ 
/*     */ public class RecordRangeController extends MultiActionController
/*     */ {
/*     */   private RecordRangeService recordRangeService;
/*     */   private DataDictionaryService dataDictionaryService;
/*     */   private String addRange;
/*     */   private String addIndustryDetail;
/*     */   private String addCountry;
/*     */   private String addProvince;
/*     */   private String addCity;
/*     */ 
/*     */   public RecordRangeService getRecordRangeService()
/*     */   {
/*  36 */     return this.recordRangeService;
/*     */   }
/*     */ 
/*     */   public void setRecordRangeService(RecordRangeService recordRangeService) {
/*  40 */     this.recordRangeService = recordRangeService;
/*     */   }
/*     */ 
/*     */   public DataDictionaryService getDataDictionaryService() {
/*  44 */     return this.dataDictionaryService;
/*     */   }
/*     */ 
/*     */   public void setDataDictionaryService(DataDictionaryService dataDictionaryService) {
/*  48 */     this.dataDictionaryService = dataDictionaryService;
/*     */   }
/*     */ 
/*     */   public String getAddRange() {
/*  52 */     return this.addRange;
/*     */   }
/*     */ 
/*     */   public void setAddRange(String addRange) {
/*  56 */     this.addRange = addRange;
/*     */   }
/*     */ 
/*     */   public String getAddCountry()
/*     */   {
/*  61 */     return this.addCountry;
/*     */   }
/*     */ 
/*     */   public void setAddCountry(String addCountry) {
/*  65 */     this.addCountry = addCountry;
/*     */   }
/*     */ 
/*     */   public String getAddIndustryDetail() {
/*  69 */     return this.addIndustryDetail;
/*     */   }
/*     */ 
/*     */   public void setAddIndustryDetail(String addIndustryDetail) {
/*  73 */     this.addIndustryDetail = addIndustryDetail;
/*     */   }
/*     */ 
/*     */   public String getAddProvince() {
/*  77 */     return this.addProvince;
/*     */   }
/*     */ 
/*     */   public void setAddProvince(String addProvince) {
/*  81 */     this.addProvince = addProvince;
/*     */   }
/*     */ 
/*     */   public String getAddCity() {
/*  85 */     return this.addCity;
/*     */   }
/*     */ 
/*     */   public void setAddCity(String addCity) {
/*  89 */     this.addCity = addCity;
/*     */   }
/*     */ 
/*     */   public ModelAndView display(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/*  94 */     Map map = new HashMap();
/*  95 */     map.put("result", request.getParameter("result"));
/*  96 */     map.put("repeat", request.getParameter("repeat"));
/*     */ 
/*  98 */     String sign = request.getParameter("sign");
/*  99 */     String recordId = request.getParameter("id");
/* 100 */     map.put("sign", sign);
/*     */ 
/* 102 */     if (!StringUtils.isEmpty(recordId)) {
/* 103 */       map.put("dataDictionary", this.dataDictionaryService.getDataDictionary(Integer.valueOf(Integer.parseInt(recordId))));
/* 104 */       map.put("recordRanges", this.recordRangeService.getActivityRecordRangesByDictionaryId(Integer.valueOf(Integer.parseInt(recordId))));
/*     */     }
/*     */ 
/* 107 */     return new ModelAndView(getAddRange(), map);
/*     */   }
/*     */ 
/*     */   public ModelAndView saveRecordRange(HttpServletRequest request, HttpServletResponse response, RecordRange recordRange)
/*     */   {
/* 112 */     boolean result = false;
/* 113 */     int success = 0;
/* 114 */     int repeat = 0;
/* 115 */     String sign = request.getParameter("sign");
/* 116 */     Integer id = Integer.valueOf(0);
/* 117 */     if (recordRange != null) {
/* 118 */       id = recordRange.getDataDictionaryId();
/*     */ 
/* 120 */       if (this.recordRangeService.isRepeatRecordRange(recordRange.getDataDictionaryId(), recordRange.getRangeValue()))
/*     */       {
/* 123 */         success = 2;
/* 124 */         return new ModelAndView(new RedirectView("./recordRange.do?action=display&result=" + success + "&sign=" + sign + "&id=" + id));
/*     */       }
/*     */ 
/* 127 */       result = this.recordRangeService.insertRecordRange(recordRange);
/* 128 */       if (result) success = 1;
/*     */     }
/* 130 */     return new ModelAndView(new RedirectView("./recordRange.do?action=display&result=" + success + "&sign=" + sign + "&id=" + id));
/*     */   }
/*     */ 
/*     */   public ModelAndView deleteRecordRange(HttpServletRequest request, HttpServletResponse response, RecordRange recordRange)
/*     */   {
/* 135 */     boolean result = false;
/* 136 */     int success = 0;
/* 137 */     String sign = request.getParameter("sign");
/* 138 */     String rangeId = request.getParameter("rangeId");
/* 139 */     Integer id = Integer.valueOf(0);
/*     */ 
/* 141 */     if ((recordRange != null) && (!StringUtils.isEmpty(rangeId))) {
/* 142 */       id = recordRange.getDataDictionaryId();
/* 143 */       result = this.recordRangeService.deleteRecordRange(Integer.valueOf(Integer.parseInt(rangeId)));
/* 144 */       if (result) success = 3;
/*     */     }
/* 146 */     return new ModelAndView(new RedirectView("./recordRange.do?action=display&result=" + success + "&sign=" + sign + "&id=" + id));
/*     */   }
/*     */ 
/*     */   public ModelAndView preAddIndustryDetail(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/* 151 */     Map map = new HashMap();
/* 152 */     map.put("result", request.getParameter("result"));
/* 153 */     map.put("repeat", request.getParameter("repeat"));
/*     */ 
/* 155 */     String parentId = request.getParameter("parentId");
/* 156 */     String recordId = request.getParameter("id");
/* 157 */     map.put("id", recordId);
/*     */ 
/* 159 */     if (!StringUtils.isEmpty(recordId)) {
/* 160 */       map.put("dataDictionary", this.dataDictionaryService.getDataDictionary(Integer.valueOf(Integer.parseInt(recordId))));
/* 161 */       map.put("industryRanges", this.recordRangeService.getActivityIndustryRanges());
/*     */ 
/* 163 */       if (!StringUtils.isEmpty(parentId)) {
/* 164 */         map.put("recordRanges", this.recordRangeService.getActivityRecordRangesByParentId(Integer.valueOf(Integer.parseInt(parentId))));
/* 165 */         map.put("paretnRangeId", parentId);
/*     */       }
/*     */     }
/*     */ 
/* 169 */     return new ModelAndView(getAddIndustryDetail(), map);
/*     */   }
/*     */ 
/*     */   public ModelAndView addIndustryDetail(HttpServletRequest request, HttpServletResponse response, RecordRange recordRange)
/*     */   {
/* 174 */     boolean result = false;
/* 175 */     int success = 0;
/* 176 */     int repeat = 0;
/* 177 */     Integer id = Integer.valueOf(0);
/* 178 */     Integer parentId = Integer.valueOf(0);
/* 179 */     if (recordRange != null) {
/* 180 */       id = recordRange.getDataDictionaryId();
/* 181 */       parentId = recordRange.getParentId();
/*     */ 
/* 183 */       if (this.recordRangeService.isRepeatIndustryDetail(parentId, recordRange.getRangeValue())) {
/* 184 */         repeat = 1;
/* 185 */         return new ModelAndView(new RedirectView("./recordRange.do?action=preAddIndustryDetail&id=" + id + "&repeat=" + repeat + "&parentId=" + parentId));
/*     */       }
/*     */ 
/* 188 */       result = this.recordRangeService.insertRecordRange(recordRange);
/* 189 */       if (result) success = 1;
/*     */     }
/*     */ 
/* 192 */     return new ModelAndView(new RedirectView("./recordRange.do?action=preAddIndustryDetail&id=" + id + "&result=" + success + "&parentId=" + parentId));
/*     */   }
/*     */ 
/*     */   public ModelAndView deleteIndustryDetailRange(HttpServletRequest request, HttpServletResponse response, RecordRange recordRange)
/*     */   {
/* 197 */     boolean result = false;
/* 198 */     int success = 0;
/* 199 */     String rangeId = request.getParameter("rangeId");
/* 200 */     Integer id = Integer.valueOf(0);
/* 201 */     Integer parentId = Integer.valueOf(0);
/* 202 */     if ((recordRange != null) && (!StringUtils.isEmpty(rangeId))) {
/* 203 */       id = recordRange.getDataDictionaryId();
/* 204 */       parentId = recordRange.getParentId();
/* 205 */       result = this.recordRangeService.deleteRecordRange(Integer.valueOf(Integer.parseInt(rangeId)));
/* 206 */       if (result) success = 3;
/*     */     }
/* 208 */     return new ModelAndView(new RedirectView("./recordRange.do?action=preAddIndustryDetail&result=" + success + "&parentId=" + parentId + "&id=" + id));
/*     */   }
/*     */ 
/*     */   public ModelAndView preAddCountry(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/* 213 */     Map map = new HashMap();
/* 214 */     map.put("result", request.getParameter("result"));
/* 215 */     map.put("repeat", request.getParameter("repeat"));
/*     */ 
/* 217 */     String sign = request.getParameter("sign");
/* 218 */     String recordId = request.getParameter("id");
/* 219 */     map.put("sign", sign);
/*     */ 
/* 221 */     if (!StringUtils.isEmpty(recordId)) {
/* 222 */       map.put("dataDictionary", this.dataDictionaryService.getDataDictionary(Integer.valueOf(Integer.parseInt(recordId))));
/* 223 */       map.put("recordRanges", this.recordRangeService.getCountryRanges());
/*     */     }
/*     */ 
/* 226 */     return new ModelAndView(getAddCountry(), map);
/*     */   }
/*     */ 
/*     */   public ModelAndView addCountryRange(HttpServletRequest request, HttpServletResponse response, RecordRange recordRange)
/*     */   {
/* 231 */     boolean result = false;
/* 232 */     int success = 0;
/* 233 */     int repeat = 0;
/* 234 */     String sign = request.getParameter("sign");
/* 235 */     Integer id = Integer.valueOf(0);
/* 236 */     if (recordRange != null) {
/* 237 */       id = recordRange.getDataDictionaryId();
/*     */ 
/* 239 */       if (this.recordRangeService.isRepeatCountry(recordRange)) {
/* 240 */         repeat = 1;
/* 241 */         return new ModelAndView(new RedirectView("./recordRange.do?action=preAddCountry&repeat=" + repeat + "&sign=" + sign + "&id=" + id));
/*     */       }
/*     */ 
/* 244 */       result = this.recordRangeService.insertCountryRange(recordRange);
/* 245 */       if (result) success = 1;
/*     */     }
/* 247 */     return new ModelAndView(new RedirectView("./recordRange.do?action=preAddCountry&result=" + success + "&sign=" + sign + "&id=" + id));
/*     */   }
/*     */ 
/*     */   public ModelAndView deleteCountryRange(HttpServletRequest request, HttpServletResponse response, RecordRange recordRange)
/*     */   {
/* 252 */     boolean result = false;
/* 253 */     int success = 0;
/* 254 */     String sign = request.getParameter("sign");
/* 255 */     String rangeId = request.getParameter("rangeId");
/* 256 */     Integer id = Integer.valueOf(0);
/*     */ 
/* 258 */     if ((recordRange != null) && (!StringUtils.isEmpty(rangeId))) {
/* 259 */       id = recordRange.getDataDictionaryId();
/* 260 */       result = this.recordRangeService.deleteCountry(Integer.valueOf(Integer.parseInt(rangeId)));
/* 261 */       if (result) success = 3;
/*     */     }
/* 263 */     return new ModelAndView(new RedirectView("./recordRange.do?action=preAddCountry&result=" + success + "&sign=" + sign + "&id=" + id));
/*     */   }
/*     */ 
/*     */   public ModelAndView preAddProvince(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/* 268 */     Map map = new HashMap();
/* 269 */     map.put("result", request.getParameter("result"));
/* 270 */     map.put("repeat", request.getParameter("repeat"));
/* 271 */     map.put("sign", request.getParameter("sign"));
/*     */ 
/* 273 */     String recordId = request.getParameter("id");
/* 274 */     map.put("id", recordId);
/* 275 */     String parentId = request.getParameter("parentId");
/* 276 */     if (!StringUtils.isEmpty(recordId)) {
/* 277 */       map.put("dataDictionary", this.dataDictionaryService.getDataDictionary(Integer.valueOf(Integer.parseInt(recordId))));
/* 278 */       map.put("countrys", this.recordRangeService.getCountryRanges());
/*     */ 
/* 280 */       if (!StringUtils.isEmpty(parentId)) {
/* 281 */         map.put("provinces", this.recordRangeService.getProvinceRanges(Integer.valueOf(Integer.parseInt(parentId))));
/* 282 */         map.put("paretnRangeId", parentId);
/*     */       }
/*     */     }
/* 285 */     return new ModelAndView(getAddProvince(), map);
/*     */   }
/*     */ 
/*     */   public ModelAndView addProvinceRange(HttpServletRequest request, HttpServletResponse response, Country country)
/*     */   {
/* 290 */     boolean result = false;
/* 291 */     int success = 0;
/* 292 */     int repeat = 0;
/* 293 */     Integer id = Integer.valueOf(0);
/* 294 */     Integer parentId = Integer.valueOf(0);
/* 295 */     String sign = request.getParameter("sign");
/* 296 */     if (country != null) {
/* 297 */       id = country.getDataDictionaryId();
/* 298 */       parentId = country.getParentId();
/*     */ 
/* 300 */       if (this.recordRangeService.isRepeatProvince(country)) {
/* 301 */         repeat = 1;
/* 302 */         return new ModelAndView(new RedirectView("./recordRange.do?action=preAddProvince&id=" + id + "&repeat=" + repeat + "&parentId=" + parentId + "&sign=" + sign));
/*     */       }
/*     */ 
/* 305 */       result = this.recordRangeService.insertCountryRange(country);
/* 306 */       if (result) success = 1;
/*     */     }
/*     */ 
/* 309 */     return new ModelAndView(new RedirectView("./recordRange.do?action=preAddProvince&id=" + id + "&result=" + success + "&parentId=" + parentId + "&sign=" + sign));
/*     */   }
/*     */ 
/*     */   public ModelAndView deleteProvinceRange(HttpServletRequest request, HttpServletResponse response, Country country)
/*     */   {
/* 314 */     boolean result = false;
/* 315 */     int success = 0;
/* 316 */     String sign = request.getParameter("sign");
/* 317 */     String provinceId = request.getParameter("provinceId");
/* 318 */     Integer id = Integer.valueOf(0);
/* 319 */     Integer parentId = Integer.valueOf(0);
/* 320 */     if ((country != null) && (!StringUtils.isEmpty(provinceId))) {
/* 321 */       id = country.getDataDictionaryId();
/* 322 */       parentId = country.getParentId();
/* 323 */       result = this.recordRangeService.deleteCountry(Integer.valueOf(Integer.parseInt(provinceId)));
/* 324 */       if (result) success = 3;
/*     */     }
/* 326 */     return new ModelAndView(new RedirectView("./recordRange.do?action=preAddProvince&result=" + success + "&parentId=" + parentId + "&id=" + id + "&sign=" + sign));
/*     */   }
/*     */ 
/*     */   public ModelAndView preAddCity(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/* 331 */     Map map = new HashMap();
/* 332 */     map.put("result", request.getParameter("result"));
/* 333 */     map.put("repeat", request.getParameter("repeat"));
/* 334 */     map.put("sign", request.getParameter("sign"));
/*     */ 
/* 336 */     String recordId = request.getParameter("id");
/* 337 */     map.put("id", recordId);
/* 338 */     String countryId = request.getParameter("countryId");
/* 339 */     String provinceId = request.getParameter("provinceId");
/* 340 */     if (!StringUtils.isEmpty(recordId)) {
/* 341 */       map.put("dataDictionary", this.dataDictionaryService.getDataDictionary(Integer.valueOf(Integer.parseInt(recordId))));
/* 342 */       map.put("countrys", this.recordRangeService.getCountryRanges());
/*     */ 
/* 344 */       if (!StringUtils.isEmpty(countryId)) {
/* 345 */         map.put("provinces", this.recordRangeService.getProvinceRanges(Integer.valueOf(Integer.parseInt(countryId))));
/* 346 */         map.put("countryId", countryId);
/*     */ 
/* 348 */         if (!StringUtils.isEmpty(provinceId)) {
/* 349 */           map.put("citys", this.recordRangeService.getCityRanges(Integer.valueOf(Integer.parseInt(provinceId))));
/* 350 */           map.put("provinceId", provinceId);
/*     */         }
/*     */       }
/*     */     }
/*     */ 
/* 355 */     return new ModelAndView(getAddCity(), map);
/*     */   }
/*     */ 
/*     */   public ModelAndView addCityRange(HttpServletRequest request, HttpServletResponse response, Country country)
/*     */   {
/* 360 */     boolean result = false;
/* 361 */     int success = 0;
/* 362 */     int repeat = 0;
/* 363 */     Integer id = Integer.valueOf(0);
/* 364 */     Integer countryId = Integer.valueOf(0);
/* 365 */     Integer provinceId = Integer.valueOf(0);
/* 366 */     String sign = request.getParameter("sign");
/* 367 */     if (country != null) {
/* 368 */       id = country.getDataDictionaryId();
/* 369 */       countryId = country.getCountryId();
/* 370 */       provinceId = country.getProvinceId();
/*     */ 
/* 372 */       if (this.recordRangeService.isRepeatCity(country)) {
/* 373 */         repeat = 1;
/* 374 */         return new ModelAndView(new RedirectView("./recordRange.do?action=preAddCity&id=" + id + "&repeat=" + repeat + "&provinceId=" + provinceId + "&countryId=" + countryId + "&sign=" + sign));
/*     */       }
/*     */ 
/* 377 */       result = this.recordRangeService.insertCountryRange(country);
/* 378 */       if (result) success = 1;
/*     */     }
/*     */ 
/* 381 */     return new ModelAndView(new RedirectView("./recordRange.do?action=preAddCity&id=" + id + "&result=" + success + "&provinceId=" + provinceId + "&countryId=" + countryId + "&sign=" + sign));
/*     */   }
/*     */ 
/*     */   public ModelAndView deleteCityRange(HttpServletRequest request, HttpServletResponse response, Country country)
/*     */   {
/* 386 */     boolean result = false;
/* 387 */     int success = 0;
/* 388 */     String sign = request.getParameter("sign");
/* 389 */     String cityId = request.getParameter("cityId");
/* 390 */     Integer id = Integer.valueOf(0);
/* 391 */     Integer countryId = Integer.valueOf(0);
/* 392 */     Integer provinceId = Integer.valueOf(0);
/* 393 */     if ((country != null) && (!StringUtils.isEmpty(cityId))) {
/* 394 */       id = country.getDataDictionaryId();
/* 395 */       countryId = country.getCountryId();
/* 396 */       provinceId = country.getProvinceId();
/* 397 */       result = this.recordRangeService.deleteCountry(Integer.valueOf(Integer.parseInt(cityId)));
/* 398 */       if (result) success = 3;
/*     */     }
/* 400 */     return new ModelAndView(new RedirectView("./recordRange.do?action=preAddCity&result=" + success + "&provinceId=" + provinceId + "&id=" + id + "&sign=" + sign + "&countryId=" + countryId));
/*     */   }
/*     */ }

/* Location:           C:\Users\e547415\MyProject\rone\WEB-INF\classes\
 * Qualified Name:     com.feeyin.radar.sys.controller.RecordRangeController
 * JD-Core Version:    0.6.0
 */